Hello all, I just want to know if it is possible to declare and store a "contains"-filter in an include file without having any current module handle.
Till now I have several Filter defined e.g. Filter fil = (attribute XY == t_Z). So far so good, but now I have to store something like that: Filter fil = contains(attribute XY, t_Z, false). But Doors says it would like to have a current module for that filter.
Does anyone know a workaround for that problem?
Br Chris leporello - Thu Nov 17 03:08:04 EST 2016 |
Re: How to store a Filter The only workaround I know of is to store the filter as string and evaluate it as soon as you have the module to use it on:
Module m = read("...");
string szFilter = "contains(attribute(\"some attribute\"), \"somevalue\", false)";
string code = "";
code = code "Module myModule = addr_ " ((addr_ m) int)";\n";
code = code "current = myModule;\n";
code = code "Filter f = (" szFilter ");\n";
code = code "set f;";
eval_ code;
Filter f = current;
If you decide to use this method you should probably also look up the 64bit int to str problem (the address of the module in code line 1 might get truncated because DOORS int to str function handles any int as 32bit) or you might run into issues later on if you use a lot of memory. |
Re: How to store a Filter O.Wilkop - Thu Nov 17 05:21:50 EST 2016 The only workaround I know of is to store the filter as string and evaluate it as soon as you have the module to use it on:
Module m = read("...");
string szFilter = "contains(attribute(\"some attribute\"), \"somevalue\", false)";
string code = "";
code = code "Module myModule = addr_ " ((addr_ m) int)";\n";
code = code "current = myModule;\n";
code = code "Filter f = (" szFilter ");\n";
code = code "set f;";
eval_ code;
Filter f = current;
If you decide to use this method you should probably also look up the 64bit int to str problem (the address of the module in code line 1 might get truncated because DOORS int to str function handles any int as 32bit) or you might run into issues later on if you use a lot of memory. If you use "read" to open the module, you can simply pass the module name to the eval_ and read it there again. Another variant for passing the module to the eval would be to loop through the open modules and find the right one inside the eval_. This will save you the hassle of passing the module via attr. Regards, Mathias |
Re: How to store a Filter
Wow! Now that's a workaround. Thank you guys for helping! Br, Chris |